var util = require('../../utils/util.js');
//获取应用实例
const app = getApp();
Page({
  onLoad: function() {
    //   app.getUser();
    wx.setStorageSync('showAdd', 0);
    var isShow = wx.getStorageSync('showAdd');
    if (isShow == 0) {
      wx.navigateTo({
        url: '../add/add'
      });
    }

  },
  onShow: function() {

    this.gotoHomePage();
  },
  // onUnload: function() { //如果页面被卸载时被执行 
  //     this.gotoHomePage();
  // },
  gotoHomePage: function() { //自定义页面跳转方法 
    var isShow = wx.getStorageSync('showAdd');
    if (isShow == 1) {
      wx.setStorageSync('showAdd', 0);
      wx.switchTab({
        url: '../index/index',
      })
    } else {
        // app.seeLogin();
      wx.setStorageSync('showAdd', 1);
      wx.navigateTo({
        url: '../add/add',
      })
    }
  }
})